from setting import *
from animation import *
from bullet import *


class BossBullet(Bullet):
    def __init__(self):
        self._layer = 5
        self.groups = allgroup, bossbulletgroup
        Bullet.__init__(self,self.groups)
        self.animation = Animation()
        self.images = self.animation.load_image(
            "images/bullet/bossbullet/bossbullet0.png", 111, 47, 1, 1)
        self.rect = self.image.get_rect()
        self.image = self.images[0]
        self.mask = pygame.mask.from_surface(self.image)

    def update(self):
        Bullet.update(self)
        self.image = self.animation.get_current_image()

    def set_bullet_type(self, type=0):
        """设置子弹的类型
           子弹的图片存在同一个目录里，以 enemybullet 加 序号 加 .png
           type 0~10
        """
        self.image_type = type
        if type >= 0 and type <=8 :
            self.images = self.animation.load_image(
                "images/bullet/bossbullet/0-" + str(type) + ".png", 72, 36, 1,
                2)
        elif type == 9:
            self.images = self.animation.load_image(
                "images/bullet/bossbullet/bossbullet1.png", 64, 111, 1, 2)
        elif type == 10:
            self.images = self.animation.load_image(
                "images/bullet/bossbullet/1-0.png", 180, 65, 1, 3)
        elif type == 11:
            self.images = self.animation.load_image(
                "images/bullet/bossbullet/1-1.png", 255, 81, 1, 3)
        elif type == 12:
            self.images = self.animation.load_image(
                "images/bullet/bossbullet/Thunder.png", 490, 157, 1, 3)
        else:
            self.images = self.animation.load_image(
                "images/bullet/bossbullet/bossbullet0.png", 111, 47, 1, 1)
        self.image = self.images[0].convert_alpha()
        self.rect= self.image.get_rect()
        self.mask = pygame.mask.from_surface(self.image)
